import request from '@/utils/request'

export function listProject(data) {
  return request({
    url: '/iam/v1/projects',
    method: 'post',
    data
  })
}

export function listServeProject(id, data) {
  return request({
    url: '/iam/v1/project/serve/' + id + '/list',
    method: 'post',
    data
  })
}

export function listTreeProject(data) {
  return request({
    url: '/iam/v1/project/tree',
    method: 'post',
    data
  })
}

export function createProject(data) {
  return request({
    url: '/iam/v1/project',
    method: 'post',
    data
  })
}

export function editProject(id, data) {
  return request({
    url: '/iam/v1/project/' + id,
    method: 'put',
    data
  })
}

export function deleteProject(id) {
  return request({
    url: '/iam/v1/project/' + id,
    method: 'delete'
  })
}

export function listUserProject(data) {
  return request({
    url: '/iam/v1/project/users',
    method: 'post',
    data
  })
}

export function addUserProject(data) {
  return request({
    url: '/iam/v1/project/user',
    method: 'post',
    data
  })
}

export function deleteUserProject(id) {
  return request({
    url: '/iam/v1/project/user/' + id,
    method: 'delete'
  })
}
